<template>
  <phonePopup v-model:show-popup="phonePopupShwo">
    <div class="phone-body-heard">设置</div>
    <div class="phone-body-box">
      <div class="setting-box">
        <div class="music-flex">
          <div class="music-text">音量</div>
          <van-slider
            v-model="musicValue"
            @change="musicValueChange"
            bar-height="12px"
            active-color="linear-gradient(90deg, #FFC500 0%, #FFB200 100%)"
            inactive-color="hsla(0, 0%, 100%, 0.8)"
            style="width: 193px"
          >
            <template #button>
              <img src="@/assets/image/music.png" class="music" />
            </template>
          </van-slider>
        </div>
      </div>
      <div class="exit-button" @click="settingExit()" >退出</div>
    </div>
  </phonePopup>
</template>
<script lang="ts" setup>
import phonePopup from "@/components/phonePopup.vue";
import { useMusicStore } from "@/store/index";
import { ref } from "vue";
const phonePopupShwo = defineModel<boolean>("show-popup");
const musicValue = ref(50);
const store = useMusicStore();
function settingExit() {
  phonePopupShwo.value = false;
}
// 音乐值改变
function musicValueChange() {
  store.setVolume(musicValue.value / 100);
}
</script>
<style lang="scss" scoped>
.phone-body-heard {
  width: 100%;
  height: 42px;
  border-radius: 10px 10px 0px 0px;
  background: #f6c67e;
  font-family: Source Han Sans;
  font-size: 18px;
  font-weight: bold;
  line-height: 32px;
  letter-spacing: 0px;
  font-variation-settings: "opsz" auto;
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
}
.phone-body-box {
  .version {
    /* 正常/正文28 */
    font-family: Source Han Sans;
    font-size: 14px;
    font-weight: 350;
    line-height: 22px;
    text-align: center;
    letter-spacing: 0px;
    /* 字体/666 */
    color: #666666;
  }
  .setting-box {
    width: 266px;
    height: 127px;
    border-radius: 10px;
    opacity: 1;
    background: #fef2da;
    box-sizing: border-box;
    border: 1px solid #eeb75b;
    margin: 20px auto;
    padding: 23px 16px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    .music-flex {
      display: flex;
      align-items: center;
      justify-content: space-around;
      .music-text {
        font-family: Source Han Sans;
        font-size: 14px;
        font-weight: 350;
        line-height: 22px;
        text-align: center;
        letter-spacing: 0px;
        color: #333333;
      }
    }
    .music {
      width: 30px;
      height: 30px;
    }
  }
  .anew-button {
    width: 229px;
    height: 44px;
    border-radius: 100px;
    opacity: 1;
    background: linear-gradient(90deg, #ffc500 0%, #ffb200 100%);
    box-shadow: inset -1px -1px 2px 0px #d89f37,
      inset 1px 1px 2px 0px rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 21px auto;
    font-family: Source Han Sans;
    font-size: 16px;
    font-weight: bold;
    line-height: 28px;
    letter-spacing: 0px;
    font-variation-settings: "opsz" auto;
    color: #ffffff;
  }
  .exit-button {
    border-radius: 100px;
    opacity: 1;
    box-sizing: border-box;
    width: 229px;
    height: 44px;
    border: 2px solid #ffc500;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 13px auto;
    font-family: Source Han Sans;
    font-size: 16px;
    font-weight: bold;
    line-height: 28px;
    letter-spacing: 0px;
    font-variation-settings: "opsz" auto;
    color: #ffc500;
  }
}
</style>
